<template>
  <div class="app-container">
    <el-row>
      <el-col :span="8" class="card-box">
        日期：
        <el-date-picker
            v-model="qs"
            type="date"
            format="yyyy 年 MM 月 dd 日"
            value-format="yyyyMMdd"
            @change="selectQs"
            placeholder="选择日期">
        </el-date-picker>
      </el-col>
      <el-col :span="8" class="card-box">开出
        <span v-html="kjNum" style="color: red" ></span>
      </el-col>
      <el-col :span="8" class="card-box">是否中奖</el-col>
    </el-row>
    <el-row>
      <el-col :span="5" class="card-box">
        <el-card>
          <div slot="header">
            <el-button @click="method1(0)" type="primary" size="mini">方法1</el-button>
            <el-button @click="savemethod1(0)" type="success" size="mini">保存</el-button>
            <span style="font-size: 10px;margin: 2px">根据上期开出的数字得到下期排除数字的情况</span>
          </div>
          <div class="el-table el-table--enable-row-hover el-table--medium">
            <span v-html="data.method1_num_p0"></span>
          </div>
        </el-card>
        <el-card>
          <div slot="header">
            <el-button @click="method2(0)" type="primary" size="mini">方法2</el-button>
            <span
                style="font-size: 10px;margin: 2px">交集获取得到2注号码，这两注号码的计算位置号码一样，则这个号码作为这个位置的排除号码</span>
          </div>
          <div class="el-table el-table--enable-row-hover el-table--medium">
            <span v-html="data.method2_num_p0"></span>
          </div>
        </el-card>
        <el-card>
          <div slot="header">
            <el-button @click="method3(0)" type="primary" size="mini">方法3</el-button>
            <el-input v-model="method3_size" size="mini"></el-input>
            <span
                style="font-size: 10px;margin: 2px">统计某一位置，开出某号码后，下一次开出另一号码的次数</span>
          </div>
          <div class="el-table el-table--enable-row-hover el-table--medium">
            <span v-html="data.method3_num_p0"></span>
          </div>
        </el-card>
        <el-card>
          <div slot="header">
            <el-button @click="method4(0)" type="primary" size="mini">方法4</el-button>
            <el-input v-model="method4_size" size="mini"></el-input>
            <span
                style="font-size: 10px;margin: 2px">把各位置 上两次开出号码差值绝对值 后 紧接着开出的号码做统计，最多的作为排除</span>
          </div>
          <div class="el-table el-table--enable-row-hover el-table--medium">
            <span v-html="data.method4_num_p0"></span>
          </div>
        </el-card>
        <el-card>
          <div slot="header">
            <el-button @click="method5(0)" type="primary" size="mini">方法5</el-button>
            <el-input v-model="method5_size" size="mini"></el-input>
            <span
                style="font-size: 10px;margin: 2px">各位置的前n期，分成3个组期， 号码交集合作为排除</span>
          </div>
          <div class="el-table el-table--enable-row-hover el-table--medium">
            <span v-html="data.method5_num_p0"></span>
          </div>
        </el-card>
        <el-card>
          <div slot="header">
            <el-button @click="method6(0)" type="primary" size="mini">方法6</el-button>
            <el-input v-model="method6_size" size="mini"></el-input>
            <span
                style="font-size: 10px;margin: 2px">随机10注，把每个位置最多的排除</span>
          </div>
          <div class="el-table el-table--enable-row-hover el-table--medium">
            <span v-html="data.method6_num_p0"></span>
          </div>
        </el-card>

      </el-col>
      <el-col :span="5" class="card-box">
        <el-card>
          <div slot="header">
            <el-button @click="method1(1)" type="primary" size="mini">方法1</el-button>
            <span style="font-size: 10px;margin: 2px">根据上期开出的数字得到下期排除数字的情况</span>
          </div>
          <div class="el-table el-table--enable-row-hover el-table--medium">
            <span v-html="data.method1_num_p1"></span>
          </div>
        </el-card>
        <el-card>
          <div slot="header">
            <el-button @click="method2(1)" type="primary" size="mini">方法2</el-button>
            <span
                style="font-size: 10px;margin: 2px">交集获取得到2注号码，这两注号码的计算位置号码一样，则这个号码作为这个位置的排除号码</span>
          </div>
          <div class="el-table el-table--enable-row-hover el-table--medium">
            <span v-html="data.method2_num_p1"></span>
          </div>
        </el-card>
        <el-card>
          <div slot="header">
            <el-button @click="method3(1)" type="primary" size="mini">方法3</el-button>
            <el-input v-model="method3_size" size="mini"></el-input>
            <span
                style="font-size: 10px;margin: 2px">统计某一位置，开出某号码后，下一次开出另一号码的次数</span>
          </div>
          <div class="el-table el-table--enable-row-hover el-table--medium">
            <span v-html="data.method3_num_p1"></span>
          </div>
        </el-card>

        <el-card>
          <div slot="header">
            <el-button @click="method4(1)" type="primary" size="mini">方法4</el-button>
            <el-input v-model="method4_size" size="mini"></el-input>
            <span
                style="font-size: 10px;margin: 2px">把各位置 上两次开出号码差值绝对值 后 紧接着开出的号码做统计，最多的作为排除</span>
          </div>
          <div class="el-table el-table--enable-row-hover el-table--medium">
            <span v-html="data.method4_num_p1"></span>
          </div>
        </el-card>
        <el-card>
          <div slot="header">
            <el-button @click="method5(1)" type="primary" size="mini">方法5</el-button>
            <el-input v-model="method5_size" size="mini"></el-input>
            <span
                style="font-size: 10px;margin: 2px">各位置的前n期，分成3个组期， 号码交集合作为排除</span>
          </div>
          <div class="el-table el-table--enable-row-hover el-table--medium">
            <span v-html="data.method5_num_p1"></span>
          </div>
        </el-card>


        <el-card>
          <div slot="header">
            <el-button @click="method6(1)" type="primary" size="mini">方法6</el-button>
            <el-input v-model="method6_size" size="mini"></el-input>
            <span
                style="font-size: 10px;margin: 2px">随机10注，把每个位置最多的排除</span>
          </div>
          <div class="el-table el-table--enable-row-hover el-table--medium">
            <span v-html="data.method6_num_p1"></span>
          </div>
        </el-card>
      </el-col>
      <el-col :span="5" class="card-box">
        <el-card>
          <div slot="header">
            <el-button @click="method1(2)" type="primary" size="mini">方法1</el-button>
            <span style="font-size: 10px;margin: 2px">根据上期开出的数字得到下期排除数字的情况</span>
          </div>
          <div class="el-table el-table--enable-row-hover el-table--medium">
            <span v-html="data.method1_num_p2"></span>
          </div>
        </el-card>
        <el-card>
          <div slot="header">
            <el-button @click="method2(2)" type="primary" size="mini">方法2</el-button>
            <span
                style="font-size: 10px;margin: 2px">交集获取得到2注号码，这两注号码的计算位置号码一样，则这个号码作为这个位置的排除号码</span>
          </div>
          <div class="el-table el-table--enable-row-hover el-table--medium">
            <span v-html="data.method2_num_p2"></span>
          </div>
        </el-card>
        <el-card>
          <div slot="header">
            <el-button @click="method3(2)" type="primary" size="mini">方法3</el-button>
            <el-input v-model="method3_size" size="mini"></el-input>
            <span
                style="font-size: 10px;margin: 2px">统计某一位置，开出某号码后，下一次开出另一号码的次数</span>
          </div>
          <div class="el-table el-table--enable-row-hover el-table--medium">
            <span v-html="data.method3_num_p2"></span>
          </div>
        </el-card>
        <el-card>
          <div slot="header">
            <el-button @click="method4(2)" type="primary" size="mini">方法4</el-button>
            <el-input v-model="method4_size" size="mini"></el-input>
            <span
                style="font-size: 10px;margin: 2px">把各位置 上两次开出号码差值绝对值 后 紧接着开出的号码做统计，最多的作为排除</span>
          </div>
          <div class="el-table el-table--enable-row-hover el-table--medium">
            <span v-html="data.method4_num_p2"></span>
          </div>
        </el-card>
        <el-card>
          <div slot="header">
            <el-button @click="method5(2)" type="primary" size="mini">方法5</el-button>
            <el-input v-model="method5_size" size="mini"></el-input>
            <span
                style="font-size: 10px;margin: 2px">各位置的前n期，分成3个组期， 号码交集合作为排除</span>
          </div>
          <div class="el-table el-table--enable-row-hover el-table--medium">
            <span v-html="data.method5_num_p2"></span>
          </div>
        </el-card>


        <el-card>
          <div slot="header">
            <el-button @click="method6(2)" type="primary" size="mini">方法6</el-button>
            <el-input v-model="method6_size" size="mini"></el-input>
            <span
                style="font-size: 10px;margin: 2px">随机10注，把每个位置最多的排除</span>
          </div>
          <div class="el-table el-table--enable-row-hover el-table--medium">
            <span v-html="data.method6_num_p2"></span>
          </div>
        </el-card>

      </el-col>
      <el-col :span="5" class="card-box">
        <el-card>
          <div slot="header"><span><i class="el-icon-cpu"></i>方法1</span></div>
          <div class="el-table el-table--enable-row-hover el-table--medium">

          </div>
        </el-card>
      </el-col>
      <el-col :span="4" class="card-box">
        <el-card>
          <div slot="header"><span><i class="el-icon-cpu"></i>方法1</span></div>
          <div class="el-table el-table--enable-row-hover el-table--medium">

          </div>
        </el-card>
      </el-col>
    </el-row>
  </div>
</template>

<script>
import {generateNum, getKjNum} from "@/api/caipiao/calpl5.js";

export default {
  name: "Pl5",
  data() {
    return {
      qs: '',
      kjNum: '',
      // 预测号码信息
      data: {
        method1_num_p0: "",
        method2_num_p0: "",
        method3_num_p0: "",
        method4_num_p0: "",
        method5_num_p0: "",
        method6_num_p0: "",
        method1_num_p1: "",
        method2_num_p1: "",
        method3_num_p1: "",
        method4_num_p1: "",
        method5_num_p1: "",
        method6_num_p1: "",
        method1_num_p2: "",
        method2_num_p2: "",
        method3_num_p2: "",
        method4_num_p2: "",
        method5_num_p2: "",
        method6_num_p2: "",
      },
      generatePl5Req: {
        qs: '',
        position: 0,
        method: 0,

      },
      method3_size: 500,
      method4_size: 120,
      method5_size: 120,
      method6_size: 10,
    };
  },
  created() {
  },

  methods: {
    method1(position) {
      if (this.qs == '') {
        alert("请选择生成号码的日期");
        return
      }
      this.openLoading();
      this.generatePl5Req.method = 1
      this.generatePl5Req.position = position
      this.generatePl5Req.qs = this.qs
      generateNum(this.generatePl5Req).then(response => {
        console.log("method1", response.data);
        if (position == 0) {
          this.data.method1_num_p0 = response.data;//
        } else if (position == 1) {
          this.data.method1_num_p1 = response.data;//
        } else if (position == 2) {
          this.data.method1_num_p2 = response.data;//
        }
        this.$modal.closeLoading();
      }).catch(() => {
        this.$modal.closeLoading();
      });
    },
    method2(position) {
      if (this.qs == '') {
        alert("请选择生成号码的日期");
        return
      }
      this.openLoading();
      this.generatePl5Req.method = 2
      this.generatePl5Req.position = position
      this.generatePl5Req.qs = this.qs
      generateNum(this.generatePl5Req).then(response => {
        console.log("method2", response.data);
        if (position == 0) {
          this.data.method2_num_p0 = response.data;//
        } else if (position == 1) {
          this.data.method2_num_p1 = response.data;//
        } else if (position == 2) {
          this.data.method2_num_p2 = response.data;//
        }
        this.$modal.closeLoading();
      }).catch(() => {
        this.$modal.closeLoading();
      });
    },
    method3(position) {
      if (this.qs == '') {
        alert("请选择生成号码的日期");
        return
      }
      this.openLoading();
      this.generatePl5Req.method = 3
      this.generatePl5Req.position = position
      this.generatePl5Req.qs = this.qs
      this.generatePl5Req.size = this.method3_size
      generateNum(this.generatePl5Req).then(response => {
        console.log("method3", response.data);
        if (position == 0) {
          this.data.method3_num_p0 = response.data;//
        } else if (position == 1) {
          this.data.method3_num_p1 = response.data;//
        } else if (position == 2) {
          this.data.method3_num_p2 = response.data;//
        }
        this.$modal.closeLoading();
      }).catch(() => {
        this.$modal.closeLoading();
      });
    },
    method4(position) {
      if (this.qs == '') {
        alert("请选择生成号码的日期");
        return
      }
      this.openLoading();
      this.generatePl5Req.method = 4
      this.generatePl5Req.position = position
      this.generatePl5Req.qs = this.qs
      this.generatePl5Req.size = this.method4_size
      generateNum(this.generatePl5Req).then(response => {
        console.log("method4", response.data);
        if (position == 0) {
          this.data.method4_num_p0 = response.data;//
        } else if (position == 1) {
          this.data.method4_num_p1 = response.data;//
        } else if (position == 2) {
          this.data.method4_num_p2 = response.data;//
        }
        this.$modal.closeLoading();
      }).catch(() => {
        this.$modal.closeLoading();
      });
    },
    method5(position) {
      if (this.qs == '') {
        alert("请选择生成号码的日期");
        return
      }
      this.openLoading();
      this.generatePl5Req.method = 5
      this.generatePl5Req.position = position
      this.generatePl5Req.qs = this.qs
      this.generatePl5Req.size = this.method5_size
      generateNum(this.generatePl5Req).then(response => {
        console.log("method5", response.data);
        if (position == 0) {
          this.data.method5_num_p0 = response.data;//
        } else if (position == 1) {
          this.data.method5_num_p1 = response.data;//
        } else if (position == 2) {
          this.data.method5_num_p2 = response.data;//
        }
        this.$modal.closeLoading();
      }).catch(() => {
        this.$modal.closeLoading();
      });
    },

    method6(position) {
      if (this.qs == '') {
        alert("请选择生成号码的日期");
        return
      }
      this.openLoading();
      this.generatePl5Req.method =6
      this.generatePl5Req.position = position
      this.generatePl5Req.qs = this.qs
      this.generatePl5Req.size = this.method6_size
      generateNum(this.generatePl5Req).then(response => {
        console.log("method6", response.data);
        if (position == 0) {
          this.data.method6_num_p0 = response.data;//
        } else if (position == 1) {
          this.data.method6_num_p1 = response.data;//
        } else if (position == 2) {
          this.data.method6_num_p2 = response.data;//
        }
        this.$modal.closeLoading();
      }).catch(() => {
        this.$modal.closeLoading();
      });
    },


    savemethod1(position) {
      if (position == 0) {
        if (this.data.method1_num_p0 == '') {
          alert("请先生成号码")
          return
        }
        this.openLoading();
        this.generatePl5Req.method = 1
        this.generatePl5Req.position = position
        this.generatePl5Req.qs = this.qs
        this.generatePl5Req.yc_num = this.method1_num_p0
        savePl3Num(this.generatePl5Req).then(response => {
          console.log("method4", response.data);
        }).catch(() => {
          this.$modal.closeLoading();
        });
      }
    },

     selectQs() {
      console.log(this.qs)
       this.openLoading();
       getKjNum(this.qs).then(response => {
         this.$modal.closeLoading();
         if(response.data) {
           this.kjNum = response.data;
         }else{
           this.kjNum = ""
         }
       }).catch(() => {
         this.$modal.closeLoading();
       });
    }
    ,
    // 打开加载层
    openLoading() {
      this.$modal.loading("正在加载数据，请稍候！");
    }
  },
}
</script>
